#include <stdio.h>
#include <QObject>
#include <QApplication>
#include <QLabel>
#include <QPushButton>
#include <QMutex>

#if defined(WIN32) || defined(_WIN64) || defined(__WATCOMC__)
#include <windows.h>
#include <conio.h>
#else
#include "../../api/inc/wincompat.h"
#endif

#include "cleaner.h"
#include "initializer.cpp"

#include "fmod.h"

using namespace anime;

QMutex draw_mutex;
Engine engine( 60, &draw_mutex );

int main(int argc, char** argv)
{
    // FMOD initialization
    FSOUND_Init(44100, 32, 0);

    QApplication app(argc, argv);
    MainWidget w(&engine, &draw_mutex);
    Controller controller(&engine, &w);
    Cleaner c(&engine, &w, &controller);
    QObject::connect(&app, SIGNAL(aboutToQuit()), &c, SLOT(clean()));
    Player::GetInstance( &engine );

    engine.AddDrawable(&w);
    w.show();
    engine.start();
    return app.exec();
}
